#include "VDModule.h"
#include "VDManager.h"
HEAD int CallingConvention VDModuleSetLog(void(*def_pLogFunc)(int level, const char* log))
{
	return VDManager::GetInstance()->VDModuleSetLog(def_pLogFunc);
}


HEAD void* CallingConvention CreateVDPlayer(void* owner)
{
	return VDManager::GetInstance()->CreateVDPlayer(owner);
}

HEAD void CallingConvention DeleteVDPlayer(void* vdplayer)
{
	VDManager::GetInstance()->DeleteVDPlayer(vdplayer);
}


HEAD void CallingConvention Open(void* vdplayer, const char* filename, void(*def_pDemuxcb)(void* owner, DemuxInfo* info))
{
	VDManager::GetInstance()->Open(vdplayer, filename, def_pDemuxcb);
}

HEAD void CallingConvention Close(void* vdplayer)
{
	VDManager::GetInstance()->Close(vdplayer);
}

HEAD void CallingConvention SetOption(void* vdplayer, int optionType, int value)
{
	VDManager::GetInstance()->SetOption(vdplayer, optionType, value);
}

HEAD void CallingConvention Play(void* vdplayer)
{
	VDManager::GetInstance()->Play(vdplayer);
}

HEAD void CallingConvention Pause(void* vdplayer)
{
	VDManager::GetInstance()->Pause(vdplayer);
}

HEAD int CallingConvention StartDemux(void* vdplayer, bool playVideo,bool tryPlayAudio, void(*def_pFramecb)(void* owner, Frame* frame))
{
	return VDManager::GetInstance()->StartDemux(vdplayer, playVideo, tryPlayAudio, def_pFramecb);
}

HEAD void CallingConvention Seek(void* vdplayer, double seekpos)
{
	VDManager::GetInstance()->Seek(vdplayer, seekpos);
}

HEAD void CallingConvention SetAudioTrack(void* vdplayer, int index)
{
	VDManager::GetInstance()->SetAudioTrack(vdplayer, index);
}

HEAD double CallingConvention GetProgress(void* vdplayer)
{
	return VDManager::GetInstance()->GetProgress(vdplayer);
}

HEAD int CallingConvention ScreenShot(void* vdplayer, int* width, int* height, unsigned char* &data)
{
	return VDManager::GetInstance()->ScreenShot(vdplayer, width, height, data);
}

HEAD void CallingConvention GetParams(void* vdplayer, InternalData* internalData)
{
	VDManager::GetInstance()->GetParams(vdplayer, internalData);
}

HEAD void CallingConvention SetCameraRect(void* vdplayer, int width, int height)
{
	VDManager::GetInstance()->SetCameraRect(vdplayer, width, height);
}

HEAD int CallingConvention GetIsPlaying(void* vdplayer)
{
	return VDManager::GetInstance()->GetIsPlaying(vdplayer);
}

HEAD void CallingConvention GetCameraParameters(void* vdplayer, const char* camera)
{
	VDManager::GetInstance()->GetCameraParameters(vdplayer, camera);
}

HEAD void CallingConvention ReleaseMemory(void* mem)
{
	if (mem == 0) return;
	delete mem;
}

HEAD void CallingConvention SetVolume(void* vdplayer, float volume)
{
	VDManager::GetInstance()->SetVolume(vdplayer, volume);
}
